import 'package:enterprise_v6_app/app/core/http/http.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/compliance_file_entity.dart';
import 'package:get/get.dart';

class ComplianceFileDetailsController extends GetxController {
  /// 列表文件数据
  final ComplianceFileEntity item = Get.arguments as ComplianceFileEntity;

  /// 详情实体
  ComplianceFileEntity fileEntity = ComplianceFileEntity();

  @override
  void onInit() {
    super.onInit();
    getDetailsData();
  }

  /// 获取详情数据
  void getDetailsData() async {
    // 获取详情接口
    final res = await HttpUtil().generateGetRequest<ComplianceFileEntity>(
      Interface.getComplianceFile,
      queryParameters: {'id': item.id},
    ).execute();
    res.onSuccess((result) {
      if (result.data != null) {
        fileEntity = result.data!;
      }
      update();
    });
  }
}
